<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // es5 面向对象
        /*
        function User(name, pass) {
            console.log(this)
            this.name = name;
            this.pass = pass
        }
        User.prototype.showName = function () {
            console.log(this)
            console.log(this.name)
        }
        // es5 继承
        function Vipuser(name, pass, level) {
            User.call(this, name, pass)
            this.level = level
        }
        Vipuser.prototype = new User()
        Vipuser.prototype.constructor = Vipuser
        User.prototype.showLevel = function () {
            console.log(this.level)
            console.log(this.name)
            console.log(this.pass)
        }
        var v1 = new Vipuser("呵呵",'1231','10')
        v1.showLevel()

        */

        // es6面向对象
        class User {
            constructor(name, pass) {
                this.name = name;
                this.pass = pass
            }
            showName(){
                console.log(this.name)
            }
        }
        class Vipuser extends User{
            constructor(name, pass,level) {
               super(name, pass)
               this.level = level
            }
            showLevel(){
                console.log(this.level)
                console.log(this.name)
                console.log(this.pass)
            }
        }
        var u1 = new Vipuser('呵呵','123456',"100")
        u1.showLevel()
    </script>

</body>

</html>